<template>
  <div>
    <h1>我是哥哥</h1>
    <p>{{ count }}</p>
    <button @click="add">累加</button>
    <!-- <button @click='unsubscribehandle'>取消订阅</button> -->
  </div>
</template>

<script>
import PubSub from "pubsub-js";
export default {
  name: "Gege",
  data() {
    return {
      count: 0,
    };
  },
  methods: {
    add() {
      this.count++;
      PubSub.publish("count", this.count);
      
    },
    // unsubscribehandle(){
    //     PubSub.unsubscribe('count') 在发布方可以解绑
    // }
  },
};
</script>

<style>
</style>